<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width">
    <title>Document</title>
</head>
<body>
    <div id="box"></div>
</body>
<script>
    // 像素比
    console.log(window.devicePixelRatio)
    (function(){
        var metaEl = document.createElement('meta');
        var scale = devicePixelRatio;
        metaEl.setAttribute('name','viewport');
        metaEl.setAttribute('content','initial-scale='+(1/scale) + ', maximun-scale=' + (scale))
        document.documentElement.firstElementChild.appendChild(metaEl)
    })();
</script>

<style>
    #box{
        width: 200px;
        height: 200px;
        background-color: red;
    }
</style>
</html>